<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue.js"></script>
  <style>
    .outer {
      width: 400px;
      height: 400px;
      background-color: paleturquoise;
      overflow: scroll;
    }

    .inner {
      width: 200px;
      height: 600px;
      margin: 100px;
      background-color: palevioletred;
    }
  </style>
</head>

<body>
  <div id="app">
    <a href="https://www.baidu.com" @click.prevent="aClickHandler">百度一下</a>
    <div class="outer" @scroll.passive="scrollHandler" @click.self="outerClickHandler">
      outer
      <div class="inner" @click.once="innerClickHandler">
        inner
      </div>
    </div>
    <input v-model="inputVal" type="text" @keyup.enter="keyUpHandler">
  </div>
  <script>
    let vm = new Vue({
      el: "#app",
      data: {
        inputVal: ''
      },
      methods: {
        outerClickHandler(e) {
          console.log('outer', e.target, e.currentTarget);
        },
        innerClickHandler(e) {
          console.log('inner', e.target, e.currentTarget);
        },
        aClickHandler() {
          console.log('点击a标签')
          alert('123')
        },
        scrollHandler() {
          let total = 0;
          for (let i = 1; i < 1000; i++) {
            total += i
          }
          console.log(total);
        },
        keyUpHandler() {
          console.log(this.inputVal);
        }
      },
      created() {

      }
    })
  </script>
</body>

</html>